package jm.data.structure.union_find;

/**
 * @Description 并查集测试运行
 * @date 2022/5/9 20:11
 */
public class UnionFindMain {
    public static void main(String[] args) {
        UnionFindObj<Student> union = new UnionFindObj<>();

        Student s1 = new Student(1, "hah");
        Student s2 = new Student(10, "hah");
        Student s3 = new Student(123, "hah");
        Student s4 = new Student(11, "hah");

        union.makeSet(s1);
        union.makeSet(s2);
        union.makeSet(s3);
        union.makeSet(s4);

        union.union(s1,s3);
        union.union(s2,s4);

        System.out.println(union.isSame(s1,s3));
        System.out.println(union.isSame(s1,s4));
        System.out.println(union.isSame(s2,s4));

        union.union(s2,s3);
        System.out.println(union.isSame(s1,s4));
    }
}
